import React, { Component } from 'react'
import Son from './Son'
import store from '../store'


export default class Com extends Component {
    add = () => {
        store.dispatch({ type: "ADD_COUNT" })
        this.setState({})
    }

    del = () => {
        store.dispatch({ type: "DEL_COUNT" })
        this.setState({})
    }
    render() {
        return (
            <div>
                <h2>
                    我是Com --- 
                </h2>
                <button onClick = {() => {
                    this.del()
                }}>---</button>
                { store.getState().count }  
                <button onClick = {() => {
                    this.add()
                }}>+++</button>
                <Son/>
            </div>
        )
    }
}
